//
//  DataBaseManager.h
//  Demo
//
//  Created by chaichai on 2022/3/2.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "Record+CoreDataClass.h"
#import "Group+CoreDataClass.h"

NS_ASSUME_NONNULL_BEGIN

@interface DataBaseManager : NSObject

@property (strong, readonly) NSManagedObjectContext *contex;
+ (instancetype)sharedManager;
///打卡
- (void)addRecord:(NSDate *)date;
///取消打卡
- (void)removeRecord:(NSDate *)date;
///总的打卡次数
- (NSInteger)totalRecords;
///总的打卡天数
- (NSInteger)totalRecordDays;
///某天的打卡数据
- (NSArray *)queryRecordsForDay:(NSDate *)date;
///指定日期的连续天数
- (NSInteger)ceaselessDaysWithDate:(NSDate *)date;
///历史最高连续打卡天数
- (NSInteger)maximumCeaselessDays;
@end
#define DB [DataBaseManager sharedManager]
NS_ASSUME_NONNULL_END
